%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
require File.dirname(__FILE__) + '/lib/jdtc'

# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
$hoe = Hoe.new('jdtc', Jdtc::VERSION) do |p|
  p.developer('Ketan Padegaonkar', 'ketanpadegaonkar@gmail.com')
  p.developer('Antoine Toulme', 'antoine@lunar-ocean.com')
  p.changes              = p.paragraphs_of("History.txt", 0..1).join("\n\n")
  p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
  p.rubyforge_name       = p.name # TODO this is default value
  # p.extra_deps         = [
  #   ['activesupport','>= 2.0.2'],
  # ]
  p.extra_dev_deps = [
    ['newgem', ">= #{::Newgem::VERSION}"]
  ]
  
  p.clean_globs |= %w[**/.DS_Store tmp *.log]
  path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
  p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
  p.rsync_args = '-av --delete --ignore-errors'
end

require 'newgem/tasks' # load /tasks/*.rake
Dir['tasks/**/*.rake'].each { |t| load t }

# TODO - want other tests/tasks run by default? Add them to the list
# task :default => [:spec, :features]

desc "Download the compiler"
task :get_ecj, :url do |t, args|
  require 'open-uri'
  require File.dirname(__FILE__) + '/lib/jdtc.rb'
  system("mkdir #{File.dirname __FILE__}/compiler")
  open("compiler/ecj-#{Jdtc::CURRENT_JDT_COMPILER}.jar","w").write(open(args.url).read)
end